package com.efounder.widget.skinview;

import android.content.Context;
import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;

import skin.support.app.SkinLayoutInflater;

/**
 * 原生组件以及部分自定义组件背景色换肤支持
 * Created by yqs
 */

public class SkinCustomViewInflater implements SkinLayoutInflater {
    @Override
    public View createView(@NonNull Context context, final String name, @NonNull AttributeSet attrs) {
        View view = null;
        switch (name) {
            case "com.google.android.material.tabs.TabLayout":
                view = new SkinTabLayout(context, attrs);
                break;
            case "androidx.recyclerview.widget.RecyclerView":
                view = new SkinCompatRecyclerView(context, attrs);
                break;
            case "com.scwang.smartrefresh.layout.SmartRefreshLayout":
                view = new SkinSmartRefreshLayout(context, attrs);
                break;
            case "androidx.core.widget.NestedScrollView":
                view = new SkinNestedScrollView(context, attrs);
                break;
            case "ListView":
                view = new SkinListView(context, attrs);
                break;
//            case "com.efounder.mobilecomps.contacts.ClearEditText":
//                view = new SkinClearEditText(context, attrs);
//                break;
//            case "com.efounder.pansoft.chat.emoji.widget.EmoticonsEditText":
//                view = ReflectUtils.reflect("com.efounder.pansoft.chat.emoji.widget.SkinEmoticonsEditText").newInstance(context, attrs).get();
//                break;
//            case "com.efounder.chat.widget.ChatTextView":
//                view = ReflectUtils.reflect("com.efounder.chat.widget.SkinChatTextView").newInstance(context, attrs).get();
//                break;
            default:
                break;
        }
        return view;
    }
}